package stark.app.frame.banner;
/**
 *  更多功能及用法请参考：https://github.com/youth5201314/banner
 添加依赖
 implementation 'com.youth.banner:banner:2.1.0'

 */
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.youth.banner.Banner;
import com.youth.banner.config.IndicatorConfig;
import com.youth.banner.indicator.CircleIndicator;

import java.util.ArrayList;
import java.util.List;

import stark.app.R;

public class BannerDemoActivity extends AppCompatActivity {
    Banner mBanner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner_demo);
        mBanner = findViewById(R.id.banner);

        mBanner.setAdapter(new TestAdapter(getTestData(), this));

        mBanner.setIndicator(new CircleIndicator(this));
        mBanner.setIndicatorGravity(IndicatorConfig.Direction.RIGHT);//设置小圆点对应N张图片
//        设置点击事件
//        mBanner.setOnBannerListener(this);
        mBanner.start();

    }

    //添加banner图片，标题可设置空字符串
    public static List<DataBean> getTestData() {
        List<DataBean> list = new ArrayList<>();
        list.add(new DataBean("https://tu.tianzuida.com/pic/upload/vod/2019-12-03/201912031575378752.jpg", "标题1", 1));
        list.add(new DataBean("https://img.zcool.cn/community/0148fc5e27a173a8012165184aad81.jpg", "标题2", 1));
        return list;
    }
}